{include file="common/head_s"/}
<body> 
<div class="rl_main">
<div class="log_box box_pan layui-clear">  
    <div class="log_logo"><img src="{$sys.logo}" alt="{$sys.name}"></div>
    <form method="post" class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <input type="text" id="username" name="username" required lay-verify="required|phone" placeholder="请输入手机号" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-item"> 
            <input type="password" id="L_pass" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        {if $sys.code=='open'}
        <div class="layui-form-item">
            <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
            <div class="rtip"><img src="{:url('verify')}" alt="captcha" onclick="this.src='{:url("verify")}?'+'id='+Math.random()"/></div>
        </div>
        {/if}
        <div class="layui-form-item"><button type="submit" class="layui-btn layui-btn-fluid layui-btn-warm" lay-filter="logsub" lay-submit>立即登录</button></div>
        <div style="width: 100%; text-align: center;"><a href="{:url('/user/index/index')}">码商登录</a></div>
    </form>
</div>
</div> 
{include file="common/footer"/}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(logsub)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('index')}",data.field,function(res){
                layer.close(loading);
                if(res.code===1){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = "{:url('index/index')}";
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                    $('.rtip img').attr('src','{:url("verify")}?id='+Math.random());
                }
            });
            return false;
        })
    })
</script>
</body>
</html>
